/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.einstein.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Tobe
 */
@Entity
@Table(name = "compania")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Compania.findAll", query = "SELECT c FROM Compania c"),
    @NamedQuery(name = "Compania.findById", query = "SELECT c FROM Compania c WHERE c.id = :id"),
    @NamedQuery(name = "Compania.findByActiva", query = "SELECT c FROM Compania c WHERE c.activa = :activa"),
    @NamedQuery(name = "Compania.findByAnoProc", query = "SELECT c FROM Compania c WHERE c.anoProc = :anoProc"),
    @NamedQuery(name = "Compania.findByCodigo", query = "SELECT c FROM Compania c WHERE c.codigo = :codigo"),
    @NamedQuery(name = "Compania.findByCreacion", query = "SELECT c FROM Compania c WHERE c.creacion = :creacion"),
    @NamedQuery(name = "Compania.findByImpuesto1", query = "SELECT c FROM Compania c WHERE c.impuesto1 = :impuesto1"),
    @NamedQuery(name = "Compania.findByImpuesto2", query = "SELECT c FROM Compania c WHERE c.impuesto2 = :impuesto2"),
    @NamedQuery(name = "Compania.findByMesProc", query = "SELECT c FROM Compania c WHERE c.mesProc = :mesProc"),
    @NamedQuery(name = "Compania.findByMoneda", query = "SELECT c FROM Compania c WHERE c.moneda = :moneda"),
    @NamedQuery(name = "Compania.findByNombre", query = "SELECT c FROM Compania c WHERE c.nombre = :nombre"),
    @NamedQuery(name = "Compania.findByPeriodos", query = "SELECT c FROM Compania c WHERE c.periodos = :periodos")})
public class Compania implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "activa")
    private boolean activa;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ano_proc")
    private int anoProc;
    @Basic(optional = false)
    @NotNull
    @Column(name = "codigo")
    private int codigo;
    @Column(name = "creacion")
    @Temporal(TemporalType.DATE)
    private Date creacion;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "impuesto_1")
    private BigDecimal impuesto1;
    @Column(name = "impuesto_2")
    private BigDecimal impuesto2;
    @Basic(optional = false)
    @NotNull
    @Column(name = "mes_proc")
    private int mesProc;
    @Column(name = "moneda")
    private Integer moneda;
    @Size(max = 255)
    @Column(name = "nombre")
    private String nombre;
    @Basic(optional = false)
    @NotNull
    @Column(name = "periodos")
    private int periodos;
    @OneToMany(mappedBy = "companiaId")
    private Collection<Subfamilia> subfamiliaCollection;
    @OneToMany(mappedBy = "companiaId")
    private Collection<Proveedor> proveedorCollection;
    @OneToMany(mappedBy = "companiaId")
    private Collection<Producto> productoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "compania")
    private Collection<Saldo> saldoCollection;
    @OneToMany(mappedBy = "companiaId")
    private Collection<Familia> familiaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "compania")
    private Collection<Movimientomaestro> movimientomaestroCollection;

    public Compania() {
    }

    public Compania(Integer id) {
        this.id = id;
    }

    public Compania(Integer id, boolean activa, int anoProc, int codigo, int mesProc, int periodos) {
        this.id = id;
        this.activa = activa;
        this.anoProc = anoProc;
        this.codigo = codigo;
        this.mesProc = mesProc;
        this.periodos = periodos;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public boolean getActiva() {
        return activa;
    }

    public void setActiva(boolean activa) {
        this.activa = activa;
    }

    public int getAnoProc() {
        return anoProc;
    }

    public void setAnoProc(int anoProc) {
        this.anoProc = anoProc;
    }

    public int getCodigo() {
        return codigo;
    }

    public void setCodigo(int codigo) {
        this.codigo = codigo;
    }

    public Date getCreacion() {
        return creacion;
    }

    public void setCreacion(Date creacion) {
        this.creacion = creacion;
    }

    public BigDecimal getImpuesto1() {
        return impuesto1;
    }

    public void setImpuesto1(BigDecimal impuesto1) {
        this.impuesto1 = impuesto1;
    }

    public BigDecimal getImpuesto2() {
        return impuesto2;
    }

    public void setImpuesto2(BigDecimal impuesto2) {
        this.impuesto2 = impuesto2;
    }

    public int getMesProc() {
        return mesProc;
    }

    public void setMesProc(int mesProc) {
        this.mesProc = mesProc;
    }

    public Integer getMoneda() {
        return moneda;
    }

    public void setMoneda(Integer moneda) {
        this.moneda = moneda;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public int getPeriodos() {
        return periodos;
    }

    public void setPeriodos(int periodos) {
        this.periodos = periodos;
    }

    @XmlTransient
    public Collection<Subfamilia> getSubfamiliaCollection() {
        return subfamiliaCollection;
    }

    public void setSubfamiliaCollection(Collection<Subfamilia> subfamiliaCollection) {
        this.subfamiliaCollection = subfamiliaCollection;
    }

    @XmlTransient
    public Collection<Proveedor> getProveedorCollection() {
        return proveedorCollection;
    }

    public void setProveedorCollection(Collection<Proveedor> proveedorCollection) {
        this.proveedorCollection = proveedorCollection;
    }

    @XmlTransient
    public Collection<Producto> getProductoCollection() {
        return productoCollection;
    }

    public void setProductoCollection(Collection<Producto> productoCollection) {
        this.productoCollection = productoCollection;
    }

    @XmlTransient
    public Collection<Saldo> getSaldoCollection() {
        return saldoCollection;
    }

    public void setSaldoCollection(Collection<Saldo> saldoCollection) {
        this.saldoCollection = saldoCollection;
    }

    @XmlTransient
    public Collection<Familia> getFamiliaCollection() {
        return familiaCollection;
    }

    public void setFamiliaCollection(Collection<Familia> familiaCollection) {
        this.familiaCollection = familiaCollection;
    }

    @XmlTransient
    public Collection<Movimientomaestro> getMovimientomaestroCollection() {
        return movimientomaestroCollection;
    }

    public void setMovimientomaestroCollection(Collection<Movimientomaestro> movimientomaestroCollection) {
        this.movimientomaestroCollection = movimientomaestroCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Compania)) {
            return false;
        }
        Compania other = (Compania) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.tesla.domain.Compania[ id=" + id + " ]";
    }
    
}
